<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/7/30
  Time: 14:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="css/login.css">
</head>
<body>
<div id="jsi-snow-container" class="container"><canvas width="1920" height="892"></canvas></div>
<div class="login">
    <h1>企业管理系统</h1>

    <div class="layui-form-item">
        <input class="layui-input" name="username" placeholder="用户名" lay-verify="required" type="text" id="username" autocomplete="off">
    </div>
    <div class="layui-form-item">
        <input class="layui-input" name="password" id="password" placeholder="密码" lay-verify="required" type="password" autocomplete="off">
    </div>
    <button class="layui-btn login_btn" id="login">登录</button>

</div>
<div style="text-align:center;background-color:whitesmoke">ICP备18018477号</div>

<script src="layui/layui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
    $("#login").click(function(){
        //发出ajax请求
        $.ajax({
            url:"${pageContext.request.contextPath}/layui-user/login",
            data:"username="+$("#username").val()+"&password="+$("#password").val(),
            dataType:"json",
            type:"post",
            success:function(data){
                if(data.code==0){
                    location="main.jsp";
                }else{
                    alert("用户名密码错误！")
                }
            }
        });
    });
    if (window.top!=null && window.top.document.URL!=document.URL){
        window.top.location= document.URL;
    }
</script>
</body>
</html>
